<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexToAdvToutaios extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    protected $table = "adv_toutiaos";
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->index('idfa','idfa');
            $table->index('imei','imei');
            $table->index('androidid','androidid');
            $table->index('source','source');
            $table->index('os','os');
            $table->index('user_status','user_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropIndex('idfa');
                $table->dropIndex('imei');
                $table->dropIndex('androidid');
                $table->dropIndex('source');
                $table->dropIndex('os');
                $table->dropIndex('user_status');
            });
        }
    }
}
